package dto

import (
	"tuowei.com/app/api/models"
	"tuowei.com/common/dto"
)

type GetTestQuestionBankReq struct {
	dto.PaginationNew `search:"-"`
	SubjectType       string `form:"subject_type" search:"type:exact;column:subject;table:sys_question_bank"`
}

func (m *GetTestQuestionBankReq) GetNeedSearch() interface{} {
	return *m
}

type GetTestQuestionBankDetailById struct {
	dto.ObjectById
}

type GetQuestionTypeReq struct {
	ChapterId      int `form:"chapter_id" vd:"$>0; msg:'章节ID不能为空'"`
	QuestionBankId int `form:"question_bank_id" vd:"$>0; msg:'题库ID不能为空'"`
}

type GetPracticeListByChapterIdReq struct {
	LinkId       int    `json:"link_id" form:"link_id" search:"type:exact;column:link_id;table:sys_question_bank_link"`
	ChapterId    int    `form:"chapter_id" json:"chapter_id" search:"type:exact;column:chapter_id;table:sys_question_bank_link"`
	SubjectType  string `form:"subject_type" json:"subject_type" search:"type:exact;column:subject_type;table:sys_question_bank_link"  comment:"题型分类 单选题/多选题/判断题/应用题"`
	ExerciseType int    `form:"exercise_type" json:"exercise_type" search:"type:exact;column:exercise_type;table:sys_question_bank_link"  comment:"练习类型 网课=1题库=2试卷=3"`
	dto.Pagination
}

func (m *GetPracticeListByChapterIdReq) GetNeedSearch() interface{} {
	return *m
}

type GetAchievementReportReq struct {
	ObjId        int `json:"obj_id" form:"obj_id" vd:"$>0; msg:'请输入对象ID exercise_type = 1 传入网课主键ID exercise_type = 2 传入题库主键ID exercise_type = 3 传入试卷主键ID'"`
	ExerciseType int `json:"exercise_type" form:"exercise_type" vd:"$>0; msg:'请输入练习题类型'"`
	ChapterId    int `json:"chapter_id" form:"chapter_id"`
	StudentId    int `json:"student_id"`
}

func (e GetAchievementReportReq) GetId() interface{} {
	return e.ObjId
}

type SubmitReq struct {
	ObjId                   int `json:"obj_id" form:"obj_id" vd:"$>0; msg:'请输入对象ID'"`
	ChapterId               int `json:"chapter_id" form:"chapter_id" `
	ExerciseType            int `json:"exercise_type" form:"exercise_type" vd:"$>0; msg:'请输入练习题类型 1-网课 2-题库 3-试卷'"`
	ErrorCount              int `json:"error_count" form:"error_count"`
	CorrectCount            int `json:"correct_count" form:"correct_count"`
	LastLeaveQuestionBankId int `json:"last_leave_question_bank_id" form:"last_leave_question_bank_id" comment:"最后一题的ID"`
}

func (e SubmitReq) Generate(record *models.SysPracticeRecordInsert) {
	e.CorrectCount = record.CorrectCount
	e.ErrorCount = record.ErrorCount
}

type AgainSubmitReq struct {
	ObjId        int `json:"obj_id" form:"obj_id" vd:"$>0; msg:'请输入题库ID'"`
	ExerciseType int `json:"exercise_type" form:"exercise_type" vd:"$>0; msg:'练习类型 1-网课，2-题库，3-试卷'"`
}

type RecordLeavePracticeReq struct {
	QuestionBankId int `json:"question_bank_id" form:"question_bank_id" vd:"$>0; msg:'请输入离开练习时最后一题的ID'"`
	ObjId          int `json:"obj_id" form:"obj_id" vd:"$>0; msg:'请输入对象ID'"`
	ExType         int `json:"ex_type" form:"ex_type" vd:"$>0; msg:'练习类型 1-网课，2-题库，3-试卷'"`
}

type RecordCompletedChapterReq struct {
}
